package com.fengmi.mapper;

import com.fengmi.entity.MallGoodsTemplate;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author 123
 * @Date 2022/2/10 11:18
 * @Version 1.0
 */

public interface GoodsTemplateMapper {
    //保存模板
    @Insert("insert into mall_goods_template (brands,spec,name) " +
            "values (#{brands},#{spec},#{name})")
    public int saveTemplate(MallGoodsTemplate mallGoodsTemplate);

    //分页条件查询所有的模板信息
    public List<MallGoodsTemplate> findTemplateByPage(MallGoodsTemplate mallGoodsTemplate);

    //通过id删除模板
    @Delete("delete from mall_goods_template where id = #{id}")
    public int delTemplateById(String id);

    //通过id查询单个模板信息
    @Select("select * from mall_goods_template where id = #{id}")
    public MallGoodsTemplate findOneById(String id);

    //查询所有模板信息
    @Select("select * from mall_goods_template")
    public List<MallGoodsTemplate> findAll();

    //修改模板信息
    @Update("update mall_goods_template set brands = #{brands}," +
            "spec = #{spec},name = #{name} where id =#{id} ")
    public int updateTemplate(MallGoodsTemplate mallGoodsTemplate);
}
